'use strict';
const dayjs = require("dayjs");
module.exports = app => {
  const { STRING, INTEGER,DATE } = app.Sequelize;
    return app.model.define(
      'calving',
      {
          id: {type: INTEGER, primaryKey: true, autoIncrement: true},
            miscarry: {type: INTEGER, allowNull: false, defaultValue: 0, comment: '是否是流产，1表示流产，0表示产犊'},
            hybrid: {type: INTEGER, allowNull: false, comment: '配种记录'},
            batch: {type: INTEGER, allowNull: false, comment: '批次'},
            calve: {type: INTEGER, allowNull: false, comment: '小牛'},
            birthday: {type:DATE, allowNull: false, comment: '出生日期'},
            operator: {type: STRING(20), allowNull: false, comment: '登记人'},
            status: {type: STRING(50), allowNull: false, comment: '状态'},
            comment: {type: STRING(50), allowNull: false, comment: '备注'},
            version: {type: INTEGER, allowNull: false, defaultValue: 1},
            is_deleted: {type: INTEGER, allowNull: false, defaultValue: 0},
      },
      {
          tableName: 'calving',
          timestamps: true, // 启用时间戳(createdAt, updatedAt)
          updatedAt: false, // 不想要 updatedAt
          createdAt: false, // 想要  createdAt 但是希望名称叫做 created_at
      }
  );
};

